home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group98b.txt / 000155_icon-group-sender _Mon Aug 24 09:08:44 1998.msg < prev    next >
Internet Message Format  |  2000-09-20  |  3KB

  1. Return-Path: <icon-group-sender>
  2. Received: from kingfisher.CS.Arizona.EDU (kingfisher.CS.Arizona.EDU [192.12.69.239])
  3.     by baskerville.CS.Arizona.EDU (8.9.1a/8.9.1) with SMTP id JAA03330
  4.     for <icon-group-addresses@baskerville.CS.Arizona.EDU>; Mon, 24 Aug 1998 09:08:44 -0700 (MST)
  5. Received: by kingfisher.CS.Arizona.EDU (5.65v4.0/1.1.8.2/08Nov94-0446PM)
  6.     id AA14216; Mon, 24 Aug 1998 09:08:20 -0700
  7. Message-Id: <2.2.32.19980822053809.003390d8@pop5.ibm.net>
  8. X-Sender: usinet.laturk@pop5.ibm.net (Unverified)
  9. X-Mailer: Windows Eudora Pro Version 2.2 (32)
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset="us-ascii"
  12. Date: Sat, 22 Aug 1998 00:38:09 -0500
  13. To: icon-group@optima.CS.Arizona.EDU
  14. From: "Dr. Louis A. Turk" <laturk@ibm.net>
  15. Subject: Why doen't this work?
  16. Errors-To: icon-group-errors@optima.CS.Arizona.EDU
  17. Status: RO
  18. Content-Length: 1859
  19.  
  20.  
  21. Can anybody tell me why this code only removes CR/LF's every other paragraph
  22. that contains them? Why
  23. does it skip a paragraph?
  24.  
  25. Louis
  26.  
  27. Obviously, there will be more to this program, once I get past this problem.
  28.  
  29. ############################################################################
  30. #############
  31. #
  32. #  HTML TO Nota Bene 4.5 FILTER
  33. #  Ver. 1.0 Aug.
  34. #  Programmer: Louis A. Turk
  35. #
  36. #  USE: Coverts HTML to Note Bene using two passes.  FIRST PASS:
  37. #    1. Removes the CR/LF's between <P> and </P> 
  38. #    2. Removes the CR/LF's between <UL> and </UL> and also removes right
  39. indention.
  40. #    SECOND PASS:
  41. #    3. Replaces all HTML code with Nota Bene code.
  42. #
  43. ############################################################################
  44. ##############
  45.  
  46.  
  47. link graphics
  48.  
  49. procedure main(arg)
  50.  
  51.     WOpen("size=1005,850")
  52.  
  53.  
  54.     infile    := arg[1]
  55.     outfile   := arg[2]
  56.     tempfile  := "temp3.txt"
  57.  
  58.         in  := open(infile,"r") | stop("Can't open file: ",in)
  59.        out := open(outfile,"w") | stop("Can't open file: ",out)
  60.     tmp := open(tempfile,"c") | stop("Can't open file: ",tmp)
  61.  
  62.         #### FIRST PASS: REMOVE EXCESS CR/LF's
  63. ######################################
  64.  
  65.     while line := read(in) do {
  66.         if find(line,"<P>") then {                            # Beginning of
  67. defective code
  68.             WWrites(line," ")
  69.             writes(tmp,line," ")
  70.             until find(line := read(in),"</P>") do {
  71.                 WWrites(line," ")
  72.                 writes(tmp,line," ")
  73.             }
  74.             WWrite(line)
  75.             write(tmp,line)
  76.         }
  77.         else if find(line,"<UL>") then {
  78.             WWrites(line," ")
  79.             writes(tmp,line," ")
  80.             until find(line := read(in),"</UL>") do {
  81.                 WWrites(line," ")
  82.                 writes(tmp,line," ")
  83.             }
  84.             WWrite(line)
  85.             write(tmp,line)
  86.         }                                                     # End of defective
  87. code        
  88.         else {
  89.             WWrite(line)
  90.             write(tmp,line)
  91.         }
  92.  
  93.     }
  94.     ##### SECOND PASS: #######################################
  95. Event()
  96. end
  97.  
  98.  
  99.